/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sc.byahi.user.shared;

import java.util.ArrayList;
import java.util.List;

//import javax.persistence.Id;

public class ProfileOwner extends AbstractEntity<String> {
	private static final long serialVersionUID = 1L;

//	@Id
	protected String id = null;

	private Boolean isAgency;
	private String agencyName;
	private Long lastLogin;

	public static final String IS_AGENCY = "isAgency"; 
	public static final String AGENCY_NAME = "agencyName"; 
	public static final String LAST_LOGIN = "lastLogin"; 
		
	// Only for VO, not to be stored in DB
	private List<Long> approvedProfiles = new ArrayList<Long>();
	private List<Long> unapporvedProfiles = new ArrayList<Long>();

	@Override
	public List<String> getUnindexedPropertyNames() {
		List<String> props = new ArrayList<String>();
		props.add(IS_AGENCY);
		props.add(AGENCY_NAME);
		props.add(LAST_LOGIN);
		return props;
	}

	@Override
	public List<String> getIndexedPropertyNames() {
		List<String> props = new ArrayList<String>();
		return props;
	}
	
	@Override
	public Object getProperty(String key) {
		if (IS_AGENCY.equals(key)) {
			return getIsAgency();
		}
		if (AGENCY_NAME.equals(key)) {
			return getAgencyName();
		}
		if (LAST_LOGIN.equals(key)) {
			return getLastLogin();
		}
		return null;
	}

	public void setProperty(String key, Object value) {
		if (IS_AGENCY.equals(key)) {
			setIsAgency((Boolean) value);
		}
		if (AGENCY_NAME.equals(key)) {
			setAgencyName((String) value);
		}
		if (LAST_LOGIN.equals(key)) {
			setLastLogin((Long) value);
		}
	}

	public ProfileOwner() {
	}
	public ProfileOwner(String id) {
		this.id = id;
	}

	public List<Long> getAllProfiles() {
		List<Long> list = new ArrayList<Long>();
		list.addAll(approvedProfiles);
		list.addAll(unapporvedProfiles);
		return list;
	}

	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		if (id != null) {
			this.id = id;
		}
	}

	public Boolean getIsAgency() {
		return isAgency;
	}

	public void setIsAgency(Boolean isAgency) {
		this.isAgency = isAgency;
	}

	public Long getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Long lastLogin) {
		this.lastLogin = lastLogin;
	}

	public List<Long> getApprovedProfiles() {
		return approvedProfiles;
	}

	public void setApprovedProfiles(List<Long> approvedProfiles) {
		if (approvedProfiles != null)
			this.approvedProfiles = approvedProfiles;
	}

	public List<Long> getUnapporvedProfiles() {
		return unapporvedProfiles;
	}

	public void setUnapporvedProfiles(List<Long> unapporvedProfiles) {
		if (unapporvedProfiles != null)
			this.unapporvedProfiles = unapporvedProfiles;
	}

	public String getAgencyName() {
		return agencyName;
	}

	public void setAgencyName(String agencyName) {
		this.agencyName = agencyName;
	}

	@Override
	public String toString() {
		return "com.biyahi.client.components.ProfileOwner[id=" + id + "]";
	}


}
